home *** CD-ROM | disk | FTP | other *** search
/ Aminet 15 / Aminet 15 - Nov 1996.iso / Aminet / dev / basic / ace24dist.lha / ace24.lha / utils / ab2ascii-1.3 / args.c < prev    next >
C/C++ Source or Header  |  1996-09-11  |  2KB  |  65 lines

  1. /*
  2.  *  ARGS.C
  3.  */
  4.  
  5. /*
  6.  * (c)Copyright 1994 by Tobias Ferber.
  7.  *
  8.  * This file is part of AmigaBASIC->ASCII.
  9.  *
  10.  * AmigaBASIC->ASCII is free software; you can redistribute it and/or
  11.  * modify it under the terms of the GNU General Public License as
  12.  * published by the Free Software Foundation; either version 1 of the
  13.  * License, or (at your option) any later version.
  14.  *
  15.  * AmigaBASIC->ASCII is distributed in the hope that it will be useful,
  16.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18.  * GNU General Public License for more details.
  19.  *
  20.  * You should have received a copy of the GNU General Public License
  21.  * along with AmigaBASIC->ASCII; see the file COPYING.  If not, write to
  22.  * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  23.  */
  24.  
  25. #include <string.h>
  26. #include <stdio.h>
  27.  
  28. static char *howtouse[]= {
  29. #ifdef DEBUG
  30.   "-d", "--debug",           "set debugging mode on",
  31. #endif
  32.   "-E", "--stderr",          "redirect error messages",
  33.   "-h", "--help",            "display this short usage information and exit",
  34.   "-o", "--output",          "set output filename (%s for the input filename)",
  35.   "-v", "--version",         "display author and version information",
  36.   (char *)0L, (char *)0L, (char *)0L
  37. };
  38.  
  39. char *
  40. convert_args(s)
  41. char *s;
  42. {
  43.   char **t= howtouse;
  44.  
  45.   while(*t)
  46.   { if(!strcmp(s,t[1]))
  47.       break;
  48.     t= &t[3];
  49.   }
  50.  
  51.   return (*t) ? *t : s;
  52. }
  53.  
  54. void
  55. display_args(void)
  56. {
  57.   char **t= howtouse;
  58.  
  59.   while(*t)
  60.   { if(t[2] && *t[2])
  61.       printf("%2s or %-16s %s\n",t[0],t[1],t[2]);
  62.     t= &t[3];
  63.   }
  64. }
  65.